/*************************************************************************
    > File Name: client.cpp
    > Author: Lancer
    > Mail: 18826075768@163.com
************************************************************************/

#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

using namespace std;

int main(){
    pid_t pid;
    pid = fork();
    if(pid < 0){
        printf("fail to fork!\n");
        exit(-1);
    }
    else if(pid == 0){
        printf("Subprocess, PID: %u, PPID: %u\n", getpid(), getppid());
    }
    else{
        printf("Parent PID: %u, Sub_process PID: %u\n", getpid(), pid);
        sleep(5);
    }
    return 0;
}